var winning_center_ul = document.querySelector(".winning_center ul"),
    data = null,num = 0;


var xhr = new XMLHttpRequest();
xhr.open("GET", " http://student.0melon0.cn/index/wheel/get_top_draw_record_list");
xhr.send();
xhr.addEventListener("readystatechange", function () {
    if (xhr.readyState == 4 && xhr.status == 200) {
        data = JSON.parse(xhr.responseText)
        //遍历data数据并添加到ul里面
         data.data.forEach((arr_li) => {
             winning_center_ul.innerHTML += `<li>恭喜${arr_li.phone}用户抽中${arr_li.prize_name}</li>`;
        });
        //中奖用户展示
        setInterval(() => {
            --num;
            winning_center_ul.style.transform = `translateY(${num*30}px)`;
            if(num*30 >= winning_center_ul.style.height){}//到底部删除定时器
        }, 1000);
        
    }
})

